﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace RukouMVC.Helpers
{
    public class ControllerHelpers
    {
        public static string Md5hash_String(string InputString)
        {
            return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(InputString, "MD5");
        }

        public static string GetRandomColor()
        {
            Random ra = new Random((new Object()).GetHashCode());

            string color = string.Empty;
            string[] Colors = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"};
            int tmp = 0;
            int minValue = 0;
            int maxValue = 15;
            for (int i = 0; i < 6; i++)
            {
                tmp = ra.Next(minValue, maxValue);
                color += Colors[tmp];
            }
            return color;
        }
    }
}
